// This file is a part of ChaosDB.
// Copyright (C) 2012 ChaoJianPeng
// email:chaojianpeng@gmail.com
//
// ChaosDB is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// any later version.
//
// ChaosDB is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.

/*
 * common_respond.cpp
 *
 *  Created on: 2012-3-2
 *      Author: chao
 */
#include <zmq.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
#include "cdb.h"
#include "byte_array.h"

///////////////
// 错误
///////////////
const int DB_ERROR = -1;
const int DB_FULL = -2;
///////////////
// 服务器命令
///////////////
const int ADD_NODE = 1;
const int BACKUP = 2;

///////////////
// 数据库命令
///////////////
const int INFO = 100;
const int ADD = 101;
const int GET = 102;
const int SET = 103;
const int REPLACE = 104;
const int REMOVE = 105;
const int ADD_INDEX = 106;
const int DEL_INDEX = 107;
const int GET_BY_INDEX = 108;


typedef struct Result{
	int len;
	void* buff;
}Result;

Result* common(zmq_msg_t* request);
